package teacher.chapter10.SerializableDeserializeDemo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class SerializeDemo {
    public static void main(String[] args) {
        Student student = new Student("John Doe", 50);

        try (FileOutputStream fileOut = new FileOutputStream("src//teacher//chapter10//SerializableDeserializeDemo//student.ser1");
             ObjectOutputStream out = new ObjectOutputStream(fileOut)) {
            out.writeObject(student);
            System.out.println("Serialized data is saved in student.ser");
        } catch (IOException i) {
            i.printStackTrace();
        }
    }
}